package com.ourteam.system.domain;

import net.dao.IDataPopulateCallback;

import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.lang.ArrayUtils;

import java.util.HashMap;

/**
 * Template Name : DTO数据对象
 * Template Version : 1
 * Template Last Modfiy Date : Thu Jul 12 16:34:06 CST 2018
 * Auto Generate Date : 2018-07-20 12:05:10
  * Warning ! This file will be overwrite when regenerate !
  *
 */
import java.util.Map;


public class SystemDepartmentBean implements java.io.Serializable {
    private static Map<String, String> mappedDaoFields = new HashMap<String, String>();

    static {
        mappedDaoFields.put("id", com.ourteam.system.dao.ISysDepartmentDAO.Id);

        mappedDaoFields.put("parentId",
            com.ourteam.system.dao.ISysDepartmentDAO.ParentId);

        mappedDaoFields.put("departmentName",
            com.ourteam.system.dao.ISysDepartmentDAO.DepartmentName);

        mappedDaoFields.put("description",
            com.ourteam.system.dao.ISysDepartmentDAO.Description);

        mappedDaoFields.put("status",
            com.ourteam.system.dao.ISysDepartmentDAO.Status);

        mappedDaoFields.put("parentDepartmentName",
            com.ourteam.system.dao.ISysDepartmentDAO.ParentDepartmentName);

        mappedDaoFields.put("modifyTime",
            com.ourteam.system.dao.ISysDepartmentDAO.ModifyTime);

        mappedDaoFields.put("operatorId",
            com.ourteam.system.dao.ISysDepartmentDAO.OperatorId);

        mappedDaoFields.put("operatorName",
            com.ourteam.system.dao.ISysDepartmentDAO.OperatorName);

        mappedDaoFields.put("sortIndex",
            com.ourteam.system.dao.ISysDepartmentDAO.SortIndex);
    }

    private com.ourteam.system.dao.SysDepartment sysDepartment;

    public SystemDepartmentBean() {
        super();

        this.sysDepartment = new com.ourteam.system.dao.SysDepartment();
    }

    public SystemDepartmentBean(
        com.ourteam.system.dao.SysDepartment sysDepartment) {
        super();

        this.sysDepartment = sysDepartment;
    }

    protected BeanMap getBeanMap() {
        return new BeanMap(sysDepartment);
    }

    public static String getMappedDAOField(String aAttrName) {
        return mappedDaoFields.get(aAttrName);
    }

    public com.ourteam.system.dao.SysDepartment convertToSysDepartment() {
        return this.sysDepartment;
    }

    public com.ourteam.system.dao.SysDepartment convertTo() {
        return this.sysDepartment;
    }

    /**
     * Get id
     *
     * @return long
     */
    public long getId() {
        return (long) this.sysDepartment.getId();
    }

    /**
     * Set id
     *
     * @parameter long
     */
    public void setId(long id) {
        this.sysDepartment.setId(id);
    }

    /**
     * Get parentId
     *
     * @return long
     */
    public long getParentId() {
        return (long) this.sysDepartment.getParentId();
    }

    /**
     * Set parentId
     *
     * @parameter long
     */
    public void setParentId(long parentId) {
        this.sysDepartment.setParentId(parentId);
    }

    /**
     * Get departmentName
     *
     * @return String
     */
    public String getDepartmentName() {
        return (String) this.sysDepartment.getDepartmentName();
    }

    /**
     * Set departmentName
     *
     * @parameter String
     */
    public void setDepartmentName(String departmentName) {
        this.sysDepartment.setDepartmentName(departmentName);
    }

    /**
     * Get description
     *
     * @return String
     */
    public String getDescription() {
        return (String) this.sysDepartment.getDescription();
    }

    /**
     * Set description
     *
     * @parameter String
     */
    public void setDescription(String description) {
        this.sysDepartment.setDescription(description);
    }

    /**
     * Get status
     *
     * @return String
     */
    public String getStatus() {
        return (String) this.sysDepartment.getStatus();
    }

    /**
     * Set status
     *
     * @parameter String
     */
    public void setStatus(String status) {
        this.sysDepartment.setStatus(status);
    }

    /**
     * Get parentDepartmentName
     *
     * @return String
     */
    public String getParentDepartmentName() {
        return (String) this.sysDepartment.getParentDepartmentName();
    }

    /**
     * Get modifyTime
     *
     * @return java.util.Date
     */
    public java.util.Date getModifyTime() {
        return (java.util.Date) this.sysDepartment.getModifyTime();
    }

    /**
     * Set modifyTime
     *
     * @parameter java.util.Date
     */
    public void setModifyTime(java.util.Date modifyTime) {
        this.sysDepartment.setModifyTime(modifyTime);
    }

    /**
     * Get operatorId
     *
     * @return long
     */
    public long getOperatorId() {
        return (long) this.sysDepartment.getOperatorId();
    }

    /**
     * Set operatorId
     *
     * @parameter long
     */
    public void setOperatorId(long operatorId) {
        this.sysDepartment.setOperatorId(operatorId);
    }

    /**
     * Get operatorName
     *
     * @return String
     */
    public String getOperatorName() {
        return (String) this.sysDepartment.getOperatorName();
    }

    /**
     * Get sortIndex
     *
     * @return int
     */
    public int getSortIndex() {
        return (int) this.sysDepartment.getSortIndex();
    }

    /**
     * Set sortIndex
     *
     * @parameter int
     */
    public void setSortIndex(int sortIndex) {
        this.sysDepartment.setSortIndex(sortIndex);
    }

    public int hashCode() {
        return org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(this);
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        } // end if

        if ((obj instanceof SystemDepartmentBean) == false) {
            return false;
        } // end if

        SystemDepartmentBean other = (SystemDepartmentBean) obj;

        boolean isEqual = false;

        com.ourteam.system.dao.SysDepartment tempSysDepartment = other.convertToSysDepartment();

        if ((tempSysDepartment == null) || (this.sysDepartment == null)) {
            isEqual = false;
        } else if ((tempSysDepartment == this.sysDepartment) ||
                tempSysDepartment.equals(this.sysDepartment)) {
            isEqual = true;
        } else {
            isEqual = false;
        }

        return isEqual;
    }

    public static SystemDepartmentBean[] toArray(
        com.ourteam.system.dao.SysDepartment[] aSysDepartments) {
        return toArray(aSysDepartments, null);
    }

    public static SystemDepartmentBean[] toArray(
        com.ourteam.system.dao.SysDepartment[] aSysDepartments,
        IDataPopulateCallback aCallBack) {
        if (ArrayUtils.isEmpty(aSysDepartments)) {
            return new SystemDepartmentBean[0];
        }

        int length = aSysDepartments.length;

        SystemDepartmentBean[] beans = new SystemDepartmentBean[length];

        for (int i = 0; i < length; i++) {
            beans[i] = new SystemDepartmentBean(aSysDepartments[i]);

            if (aCallBack != null) {
                aCallBack.populate(beans[i], new Object[] { aSysDepartments[i] });
            }
        }

        return beans;
    }
}
